package com.itec.learn.spring.aop;

import java.util.logging.Logger;

/**
 * 通过静态代理解决日志代码与业务代码耦合的问题
 * @author chenyiqun
 */
public class HelloProxy implements IHello {
    private Logger logger = Logger.getLogger(getClass().getName());

    private IHello helloObj;

    public HelloProxy(IHello helloObj){
        this.helloObj = helloObj;
    }

    @Override
    public void hello(String name) {
        logger.info("hello method starts...");
        helloObj.hello(name);
        logger.info("hello method ends...");
    }

    @Override
    public Integer hi(String name) {
        helloObj.hi(name);
        return 0;
    }
}
